/************************************************************************

								Heroes IV
					  Copyright 2002, The 3DO Company

	------------------------------------------------------------------
  						      dialog_booty.h

	$Header: $

	$NoKeywords: $

 ************************************************************************/

#ifndef DIALOG_BOOTY_H_INCLUDED
#define DIALOG_BOOTY_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <string>

#include "artifact.h"
#include "bitmap_group_ptr.h"
#include "bitmap_layer_window_ptr.h"
#include "button_ptr.h"
#include "drag_artifact_source_holder.h"
#include "game_window.h"

class t_creature_array;
class t_creature_array_window;

// ---------------------------------------------------------------------------
// Dialog to distribute the captured artifacts after winning a battle
// ---------------------------------------------------------------------------
class t_dialog_booty : public t_window, public t_drag_artifact_source_holder
{
	public:
		t_dialog_booty( t_window * parent,
						t_creature_array & winners,
						t_artifact_list & booty,
						std::string const & title,
						std::string const & text );

		// Overrides from t_drag_artifact_source_holder
		virtual void accept_artifact_drag( t_drag_artifact* drag, t_drag_artifact_source* dest );
		virtual void artifact_accepted( t_drag_artifact_source * source, t_window * target );
		virtual void begin_artifact_drag( t_drag_artifact_source* source );
		virtual void restore( t_drag_artifact_source* source );
		virtual	void update_artifacts();

	protected:
		enum
		{
			k_max_displayed_booty = 5
		};

		// Info about a displayed piece of booty
		struct t_booty_display
		{
			int										booty_index; // Index in m_booty
			t_counted_ptr<t_drag_artifact_source>	window;      // Display window
			t_bitmap_window_ptr						frame;       // Unhighlighted frame
			t_bitmap_window_ptr						highlighted_frame; 
		};


		void									ok_clicked();
		virtual void							on_close();
		void									scroll_left();
		void									scroll_right();
		void									update_booty_display();

		t_bitmap_group_ptr						m_bitmaps;
		t_artifact_list	&						m_booty;
		t_booty_display 						m_booty_display[ k_max_displayed_booty ];
		int										m_booty_display_start;
		int										m_current_drag_index;
		t_button_ptr							m_scroll_left_button;
		t_button_ptr							m_scroll_right_button;
		t_creature_array &						m_winners;
		t_counted_ptr<t_creature_array_window>	m_winners_window;
};

#endif // DIALOG_BOOTY_H_INCLUDED
